import  {request} from "./request"

//根据iid获取商品详情页数据
export function getDetail(iid){
 return request({
     url:"/detail/",
     params:{
         iid,
     }
 })
}

//获取首页商品数据
export function getRecommend(){
    return request({
        url:"/recommend",
    })
}

//产品详情页数据类
export class Goods{

    //构造函数
    constructor(itemInfo,columns,services){
        this.titlle=itemInfo.title;//标题
        this.desc = itemInfo.desc;//款式
        this.newPrice = itemInfo.price;//目前价格
        this.oldPrice = itemInfo.oldPrice;//老价格
        this.discount = itemInfo.discountDesc;//折扣
        this.columns = columns;//["销量 28989","收藏93人","默认快递"]
        this.services = services;//退换货栏目
        this.realPrice = itemInfo.lowNowPrice;//价格
    }

}

//产品具体详情
export class GoodsParam {
    constructor(info, rule) {
      // 注：images可能没有值(某些商品优质，某些没有值)
      this.image = info.images ? info.images[0] : '';
      this.infos = info.set;
      this.sizes = rule.tables;//尺码
    }
  }